import axios from '@/api/fetch';
import SERVER from '@/api/server';

// 获取PDI申请单数据
export const getPDIApplicationList = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/otherBusiness/maintainPDI/getPDIApplicationList`, { params });

// 根据ID获取PDI申请单数据
export const getPDIById = id => axios.get(`${SERVER.DMSCLOUD_REPAIR}/otherBusiness/maintainPDI/getPDIById/${id}`);

// 根据ID删除数据
export const deletePDIById = id => axios.delete(`${SERVER.DMSCLOUD_REPAIR}/otherBusiness/maintainPDI/deletePDIById/${id}`, { id: Number(id) });

// 保存保养单数据
export const savePDI = params => axios.post(`${SERVER.DMSCLOUD_REPAIR}/otherBusiness/maintainPDI/savePDI`, params);

// 获取委托书列表
export const getRepairOrder = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/otherBusiness/maintainPDI/getRepairOrder`, { params });

// 提交
export const submitPDI = id =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/otherBusiness/maintainPDI/submitPDI/${id}`, {
    id: Number(id)
  });

// 取消提交
export const cancelSubmitPDI = id =>
  axios.get(`${SERVER.DMSCLOUD_REPAIR}/otherBusiness/maintainPDI/cancelSubmitPDI/${id}`, {
    id: Number(id)
  });

// 获取PDI申请单审核信息
export const getPDIAuditLog = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/otherBusiness/maintainPDI/getPDIAuditLog`, { params });

// 获取PDI申请单明细数据
export const getDtlList = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/otherBusiness/maintainPDI/getDtlList`, { params });

// 删除PDI申请单明细
export const deleteDtlById = id => axios.delete(`${SERVER.DMSCLOUD_REPAIR}/otherBusiness/maintainPDI/deleteDtlById/${id}`, { id: Number(id) });

// 获取新增明细页面列表信息
export const getAddMaintainPDIDtls = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/otherBusiness/maintainPDI/getAddMaintainPDIDtls`, { params });

// 获取经销商下网点信息
export const getNetWorksByDealer = params => axios.get(`${SERVER.DMSCLOUD_REPAIR}/otherBusiness/maintainPDI/getNetWorksByDealer`, { params });

// 获取文件类型列表
export const getPictureTypeList = () => axios.get(`${SERVER.DMSCLOUD_REPAIR}/otherBusiness/maintainPDI/getPictureTypeList`, {});

// 保存文件？
export const setFile = params => axios.post(`${SERVER.SERVICE_CLAIMMANAGE}/claim/insert`, params);

// 获取上传文件列表
export const getFileList = id => axios.get(`${SERVER.DMSCLOUD_REPAIR}/otherBusiness/maintainPDI/getFileList/${id}`, { id: Number(id) });

// 删除附件
export const deleteFile = id => axios.delete(`${SERVER.DMSCLOUD_REPAIR}/otherBusiness/maintainPDI/deleteFile/${id}`, { id: Number(id) });
